home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 2.0 KB | 93 lines | [TEXT/MPS ] |
- //-----------------------------------------------------------------------------
- // FWCyStrm.h
- //
- // Copyright (c) 1995 - 1996 by Apple Computer, Inc., all rights reserved.
- //-----------------------------------------------------------------------------
-
- #ifndef _FW_CyberdogStreamUtilities_
- #define _FW_CyberdogStreamUtilities_
-
- extern const short FW_kCyberStreamDone; // = kCDErrorOccurred | kCDDownloadComplete | kCDAbortComplete
-
- /*
- FW_CCyberStream is an envelope class for CyberStream.
- It ensures that CyberStream will be deleted when you're done
- with it. It also makes sure that Abort is properly called if
- the stream has not been fully read.
- */
-
- class CyberStream;
-
- class FW_CCyberStream {
- public:
- FW_DECLARE_AUTO (FW_CCyberStream)
- FW_CCyberStream (CyberStream* cs = kODNULL);
- ~FW_CCyberStream ();
- FW_CCyberStream& operator= (CyberStream* cs);
- void Assign (CyberStream* cs);
- CyberStream* operator -> ();
- operator CyberStream* ();
- private:
- CyberStream* fStream;
- // Copy construction and assignment is not supported.
- private:
- FW_CCyberStream (const FW_CCyberStream& );
- FW_CCyberStream& operator= (const FW_CCyberStream& );
- };
-
- /*
- FW_CCyberBuffer is an envelope class for a buffer aquired from a
- CyberStream. This ensures it is released back to the stream.
- */
-
- class FW_CCyberBuffer {
- public:
- FW_DECLARE_AUTO (FW_CCyberBuffer)
- FW_CCyberBuffer (Environment* ev, CyberStream* cs);
- ~FW_CCyberBuffer ();
- Size GetSize() { return fSize; }
- Ptr GetBuffer() { return fBuffer; }
- private:
- CyberStream* fStream;
- Ptr fBuffer;
- Size fSize;
- };
-
- /*
- Boring inlines.
- */
-
- inline
- FW_CCyberStream::FW_CCyberStream (CyberStream* cs = kODNULL)
- : fStream(cs)
- {
- }
-
- inline
- FW_CCyberStream::~FW_CCyberStream ()
- {
- Assign(kODNULL);
- }
-
- inline
- FW_CCyberStream& FW_CCyberStream::operator= (CyberStream* cs)
- {
- Assign(cs);
- return *this;
- }
-
- inline CyberStream*
- FW_CCyberStream::operator -> ()
- {
- return fStream;
- }
-
- inline
- FW_CCyberStream::operator CyberStream* ()
- {
- return fStream;
- }
-
- #endif // _FW_CyberdogStreamUtilities_
-
-